import pymysql
import pandas as pd

'''
pandas直接读取mysql
'''

# 打开数据库连接
conn = pymysql.connect(host="localhost",
                       port=3306,
                       user="root",
                       passwd="123123",
                       db="springdatajdbc")
sql = "select * from employee"
df = pd.read_sql_query(sql, conn)
# 关闭连接
conn.close()
print(df)
